from django.db import models
import mongoengine
from mongoengine import *
from django.core.files import *
from PIL import *

from CarpoolWithFriends.settings import DBNAME
from CarpoolWithFriends.settings import HOST
from CarpoolWithFriends.settings import PORT

connect(DBNAME,host=HOST,port=PORT)

# Create your models here.
class SocialAccount(EmbeddedDocument):
	network_type = StringField(max_length=64)
	username = StringField(max_length=64)
	password = StringField(max_length=64)

class Message(EmbeddedDocument):
	sender_email = EmailField()
	receiver_email = EmailField()
	send_date = DateTimeField()
	content = StringField()
	carpool_no = IntField()
	msg_type = StringField()
	msg_status = StringField()

#class Users(Document):
class Users(Document):
	id	 = ObjectIdField()
	email = EmailField(required = True)
	password = StringField(max_length=64, required = True)
	register_type = StringField(max_length=10)
	facebook_token = StringField(max_length=128)
	first_name = StringField(max_length=64,required = True)
	last_name = StringField(max_length=64,required = True)
	education = StringField(max_length=64)
	age = IntField()
	interest = StringField()
	phone = StringField(max_length=15)
	current_city = StringField(max_length=32)
	credit_score= DecimalField()
	completed_carpool_list = ListField(IntField())
	ongoing_carpool_list = ListField(IntField())
	notification_list = ListField(IntField())
	friend_list = ListField(IntField())
	profile = FileField()